import com.arcadedb.database.Binary;
import com.arcadedb.database.Database;
import com.arcadedb.database.DatabaseFactory;
import com.arcadedb.graph.MutableVertex;

import java.util.Arrays;

public class ArcadeTest {
    public static void main(String[] args) {
        DatabaseFactory dbf = new DatabaseFactory("./databases/testArc");
        Database database;
        if (dbf.exists()){
            database = dbf.open();
        }else{
            database = dbf.create();
        }
        database.begin();
        if (!database.getSchema().existsType("test")){
            database.getSchema().createVertexType("test");
        }
        MutableVertex vertex = database.newVertex("test");
        vertex.set("stat", "stat".getBytes());
        vertex.save();

        Binary binary = new Binary(vertex.getBinary("stat"));
        System.out.println(new String(binary.toByteArray()));
        database.commit();
        database.close();
    }
}
